﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web.UI.HtmlControls;

using AjaxControlToolkit;
using BizElements.Core;
using BizElements.BusinessLayer;

namespace BizElements.Web
{
    /// <summary>UI component (user control) for editing IDataObject business objects.</summary>
    public interface IBusinessObjectUI<T> : IDataObjectUI
     where T : class, IBusinessObject
    {
        #region Properties.

        /// <summary>Business object bound to user control.</summary>
        new T BizObject { get; set; }

        /// <summary>Specifies whether to hide children, ie. subgrids.</summary>
        bool ChildrenHidden { get; set; }

        #endregion

        #region Methods.

        /// <summary>Sets focus to first control.</summary>
        void Focus();

        #endregion

        #region Events.

        /// <summary>Occurs when a new child entity should be created via its dedicated form.</summary>
        event EventHandler<EventArgs<WebFormContext>> NewChild;

        /// <summary>Occurs when an existing child entity should be edited or viewed in its dedicated form.</summary>
        event EventHandler<EventArgs<WebFormContext>> OpenChild;

        /// <summary>Occurs when user presses "Cancel" button.</summary>
        event EventHandler Canceled;

        /// <summary>Occurs when user presses "Deactivate" button.</summary>
        event EventHandler Deactivated;

        /// <summary>Occurs when user presses "Save" button.</summary>
        event EventHandler Saved;

        #endregion
    }
}
